flag_jobs: Option<u32>,
flag_manifest_path: Option<String>,
flag_test: Option<String>,
+ flag_bin: Option<String>,
flag_no_default_features: bool,
flag_no_run: bool,
flag_package: Option<String>,
Options:
-h, --help Print this message
- --test NAME Name of the test executable to run
+ --test NAME Name of the integration test to run
+ --bin NAME Name of the binary to run tests for
--no-run Compile, but don't run tests
-p SPEC, --package SPEC Package to run tests for
-j N, --jobs N The number of jobs to run in parallel
let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
config.shell().set_verbose(options.flag_verbose);
- let mut tests = Vec::new();
+ let (mut tests, mut bins) = (Vec::new(), Vec::new());
if let Some(s) = options.flag_test {
tests.push(s);
}
+ if let Some(s) = options.flag_bin {
+ bins.push(s);
+ }
let ops = ops::TestOptions {
no_run: options.flag_no_run,
exec_engine: None,
release: false,
mode: ops::CompileMode::Test,
- filter: if tests.len() == 0 {
+ filter: if tests.len() == 0 && bins.len() == 0 {
ops::CompileFilter::Everything
} else {
ops::CompileFilter::Only {
- lib: false, bins: &[], examples: &[], benches: &[],
- tests: &tests,
+ lib: false, examples: &[], benches: &[],
+ tests: &tests, bins: &bins,
}
}
},
-> CargoResult<Vec<(&'a Target, &'a Profile)>> {
let profiles = pkg.manifest().profiles();
let build = if release {&profiles.release} else {&profiles.dev};
+ let test = if release {&profiles.bench} else {&profiles.test};
let profile = match mode {
- CompileMode::Test => if release {&profiles.bench} else {&profiles.test},
+ CompileMode::Test => test,
CompileMode::Bench => &profiles.bench,
CompileMode::Build => build,
};
named `{}`",
desc, name))),
};
+ debug!("found {} `{}`", desc, name);
targets.push((t, profile));
}
Ok(())
};
try!(find(bins, "bin", TargetKind::Bin, profile));
- try!(find(examples, "example", TargetKind::Example,
- &profiles.dev));
- try!(find(tests, "test", TargetKind::Test, &profiles.test));
+ try!(find(examples, "example", TargetKind::Example, build));
+ try!(find(tests, "test", TargetKind::Test, test));
try!(find(benches, "bench", TargetKind::Bench, &profiles.bench));
}
Ok(targets)